package com.apes.fn.scm.retailOrder.service.tc.vipSurplus.report;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import com.apes.scm.masterdata.frame.model.Dept;
import com.apes.scm.masterdata.party.model.PartyRole;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @Title: VipSurplusDaily
 * @Description: 会员联盟日报表
 * @author: ZhengZeXian
 * @create: 2022/1/14 9:22
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = VipSurplusDaily.CONST_TABLE_NAME)
public class VipSurplusDaily extends BaseModel {

    public static final String CONST_TABLE_NAME = "vip_surplus_daily";

    @Id
    @Column(name = "id",nullable = false, length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "会员联盟日报表编码", padding = 10)
    @Comment("编码")
    private String id;

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "belong_company_id", referencedColumnName = "id")
    @Comment("所属公司")
    private PartyRole belongCompany;

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "company_id", referencedColumnName = "id")
    @Comment("记账公司")
    private PartyRole company;

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "platform_company_id", referencedColumnName = "id")
    @Comment("平台公司代码")
    private PartyRole platformCompany;

    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "use_company_id", referencedColumnName = "id")
    @Comment("消费公司")
    private PartyRole useCompany;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "belong_dept_id", referencedColumnName = "id")
    @Comment("所属部门")
    private Dept belongDept;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "consumer_dept_id", referencedColumnName = "id")
    @Comment("消费部门")
    private Dept consumerDept;


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "supplier_id", referencedColumnName = "id")
    @Comment("供应商")
    private PartyRole supplier;


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "customer_id", referencedColumnName = "id")
    @Comment("客户")
    private PartyRole customer;

    @Comment("汇总日期")
    @Column(name = "collect_date")
    private Date collectDate;

    @Column(name = "state")
    @Comment("状态")
    private String state;   //done 完成

    @Column(name = "type")
    @Comment("类型")
    private String type;   //done 完成


    @Column(name = "use_savings", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("使用储值")
    private double useSavings = 0;

    @Column(name = "give_savings", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("储值应结")
    private double giveSavings = 0;

    @Column(name = "user_cash_back", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("使用返现金额")
    private double userCashBack = 0;

    @Column(name = "give_cash_back", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("返现金额应结")
    private double giveCashBack = 0;

    @Column(name = "use_gift_red", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("使用赠送红包")
    private double useGiftRed = 0;

    @Column(name = "give_gift_red", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("赠送红包应结")
    private double giveGiftRed = 0;

    @Column(name = "use_bao_red", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("使用保呗红包")
    private double useBaoRed = 0;

    @Column(name = "give_bao_red", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("保呗红包应结")
    private double giveBaoRed = 0;

    @Column(name = "use_voucher", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("使用兑换券")
    private double useVoucher = 0;

    @Column(name = "give_voucher", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("兑换券应结")
    private double giveVoucher = 0;

    @Column(name = "give_amount_total", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("应结金额总计")
    private double giveAmountTotal = 0;

    @Column(name = "give_red_tax", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("红包应结税额")
    private double giveRedTax = 0;

    @Column(name = "give_bao_red_tax", nullable = false, columnDefinition = ApesConst.FIELD_QTY_16_4_0)
    @Comment("保呗红包应结税额")
    private double giveBaoRedTax = 0;

}
